#ifndef PARAMETER_HPP
#define PARAMETER_HPP

#include <QObject>
#include <GL/gl.h>
#include <vector>
#include <string>
using namespace std;

class UserParameter : public QObject
{
	Q_OBJECT
public:
	GLenum  facefront;
	float   color[3];
	float   rotation[3];
	float   rotationold[3];
	bool    rotated;
	float   translation[3];
	float   nearer;
	float   farer;
	GLenum  primitive;
	void init();
	UserParameter(){init();}
signals:
	void refresh();
public slots:
	void reset();
	void setstruct(bool clockwise, char view);
	void setcolor(int red, int green, int blue);
	void settrans(float x, float y, float z);
	void setrotat(float x, float y, float z);
	void setclip(float n, float f);
};

class InputParameter : public QObject
{
	Q_OBJECT
public:
	struct material
	{
		float   acolor[3];
		float   dcolor[3];
		float   scolor[3];
		float   shine;
	};
	struct triangle
	{
		struct vertex
		{
			float   pos[3];
			float   norm[3];
			int     matind;
		};
		vertex  v[3];
		float   fnorm[3];
		float   color[3];
	};
	string              name;
	int                 trinum;
	int                 marnum;
	vector<material>    mat;
	vector<triangle>    tri;
	float               pmax[3], pmin[3];
	float               distance;
signals:
	void initpara(double movxmin, double movxmax, double movymin, double movymax,
				  double movzmin, double movzmax, double nearmin, double farmax);
	void reset();
public slots:
	void readfile(const char* file);
};

#endif // PARAMETER_HPP
